home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
081-090
/
amok89
/
amigaguide
/
amigaguide.mod
next >
Wrap
Text File
|
1993-11-04
|
14KB
|
411 lines
MODULE AmigaGuide;
(*---------------------------------------------------------------------------
** AmigaGuide v1.24 (34.6) -- Oberon System Interface Modul
**---------------------------------------------------------------------------
** Oberon: Amiga-Oberon v3.00, F. Siebert / A+L AG
**---------------------------------------------------------------------------
** 14-Apr-93 [lars]
**---------------------------------------------------------------------------
** Known problems:
** - The second parameter of OpenAmigaGuideAsync() is either a tag list
** (so say the includes) or a dummy for future use (so says the autodocs).
** - Several functions of the library are mentioned in the includes, but
** not in the autodocs.
** - The XRef node embodies a 'struct DocFile *' without 'struct DocFile'
** being defined anywhere.
**---------------------------------------------------------------------------
*)
IMPORT Dos, Exec, InputEvent, Intuition, sys:SYSTEM, Utility;
(*-------------------------------------------------------------------------*)
TYPE
(* Pointers: *)
AmigaGuideContext * = sys.ADDRESS;
AmigaGuideHostPtr * = UNTRACED POINTER TO AmigaGuideHost;
AmigaGuideMsgPtr * = UNTRACED POINTER TO AmigaGuideMsg;
ContextTablePtr * = UNTRACED POINTER TO ContextTable;
MethodPtr * = UNTRACED POINTER TO Method;
Msg * = MethodPtr; (* The official name *)
OpFindHostPtr * = UNTRACED POINTER TO OpFindHost;
OpNodeIOPtr * = UNTRACED POINTER TO OpNodeIO;
OpExpungeNodePtr * = UNTRACED POINTER TO OpExpungeNode;
NewAmigaGuidePtr * = UNTRACED POINTER TO NewAmigaGuide;
XRefPtr * = UNTRACED POINTER TO XRef;
CONST
(* Various *)
name * = "amigaguide.library";
alted * = { InputEvent.lAlt, InputEvent.rAlt };
shifted * = { InputEvent.lShift, InputEvent.rShift };
(* Tag attributes accepted by GetAmigaGuideAttr() *)
dummy * = Utility.user;
path * = dummy + 1;
xrefList * = dummy + 2;
activate * = dummy + 3;
TYPE
AmigaGuideMsg * = STRUCT (msg * : Exec.Message)
type * : Exec.ULONG; (* Type of message *)
data * : Exec.APTR; (* Pointer to message data *)
dSize * : Exec.ULONG; (* Size of message data *)
dType * : Exec.ULONG; (* Type of message data *)
priRet * : Exec.ULONG; (* Primary return value *)
secRet * : Exec.ULONG; (* Secondary return value *)
system1 * : Exec.APTR;
system2 * : Exec.APTR;
END;
CONST
(* AmigaGuideMsg.type *)
apshToolID * = 11000;
startupMsgID * = apshToolID + 1; (* Startup message *)
loginToolID * = apshToolID + 2; (* Login a tool SIPC port *)
logoutToolID * = apshToolID + 3; (* Logout a tool SIPC port *)
shutdownMsgID * = apshToolID + 4; (* Shutdown message *)
activateToolID * = apshToolID + 5; (* Activate tool *)
deactivateToolID * = apshToolID + 6; (* Deactivate tool *)
activeToolID * = apshToolID + 7; (* Tool Active *)
inactiveToolID * = apshToolID + 8; (* Tool Inactive *)
toolStatusID * = apshToolID + 9; (* Status message *)
toolCmdID * = apshToolID + 10; (* Tool command message *)
toolCmdReplyID * = apshToolID + 11; (* Reply to tool command *)
shutdownToolID * = apshToolID + 12; (* Shutdown tool *)
TYPE
(* Allocation description structure *)
NewAmigaGuide * = STRUCT
lock * : Dos.FileLockPtr; (* Lock on the document directory *)
name * : Exec.STRPTR; (* Name of document file *)
screen * : Intuition.ScreenPtr; (* Screen to place windows within *)
pubScreen * : Exec.STRPTR; (* Public screen name to open on *)
hostPort * : Exec.STRPTR; (* Application's ARexx port name *)
clientPort * : Exec.STRPTR; (* Name to assign to the clients ARexx port *)
baseName * : Exec.STRPTR; (* Base name of the application *)
flags * : LONGSET; (* Flags *)
context * : ContextTablePtr; (* NIL terminated context table *)
node * : Exec.STRPTR; (* Node to align on first (defaults to Main) *)
line * : LONGINT; (* Line to align on *)
extens * : Utility.TagItemPtr; (* Tag array extension *)
client * : sys.ADDRESS; (* Private! MUST be NULL *)
END;
(* The ContextTable in NewAmigaGuide is an array of Exec.STRPTRs, terminated
* by a NIL pointer.
* This definition keeps the array character, but can't be allocated
* directly with NEW()!
*)
ContextTable * = ARRAY 536870911 OF Exec.STRPTR;
CONST
(* public Client flags (NewAmigaGuide.flags) *)
loadIndex * = 0; (* Force load the index at init time *)
loadAll * = 1; (* Force load the entire database at init *)
cacheNode * = 2; (* Cache each node as visited *)
cacheDB * = 3; (* Keep the buffers around until expunge *)
unique * = 15; (* Unique ARexx port name *)
noActivate * = 16; (* Don't activate window *)
sysGads * = 31;
(* Callback function ID's *)
open * = 0;
close * = 1;
(* Callback error codes *)
notEnoughMemory * = 100;
cantOpenDataBase * = 101;
cantFindNode * = 102;
cantOpenNode * = 103;
cantOpenWindow * = 104;
invalidCommand * = 105;
cantComplete * = 106;
portClosed * = 107;
cantCreatePort * = 108;
keywordNotFound * = 113;
TYPE
(* Cross reference node *)
XRef * = STRUCT (node * : Exec.Node)
pad * : Exec.UWORD; (* Padding *)
df * : Exec.ADDRESS; (* Document defined in ('DocFilePtr') *)
file * : Exec.STRPTR; (* Name of document file *)
name * : Exec.STRPTR; (* Name of item *)
line * : LONGINT; (* Line defined at *)
END;
CONST
XRSize * = SIZE (XRef); (* A neato... *)
(* Types of cross reference nodes *)
generic * = 0;
function * = 1;
command * = 2;
include * = 3;
macro * = 4;
struct * = 5;
field * = 6;
typedef * = 7;
define * = 8;
TYPE
(* Callback handle *)
AmigaGuideHost * = STRUCT (dispatcher * : Utility.Hook)
reserved * : Exec.ULONG; (* Must be 0 *)
flags * : LONGSET;
useCnt * : Exec.ULONG; (* Number of open nodes *)
systemData * : Exec.APTR; (* Reserved for system use *)
userData * : Exec.APTR; (* Anything you want... *)
END;
CONST
(* methodIDs of the various commands *)
findNode * = 1;
openNode * = 2;
closeNode * = 3;
expunge * = 10; (* Expunge DataBase *)
TYPE
(* Basetype of the command structures *)
Method * = STRUCT
ID * : Exec.ULONG;
END;
(* Method 'findNode' *)
OpFindHost * = STRUCT (method * : Method)
attrs * : Utility.TagItemPtr; (* R: Additional attributes *)
node * : Exec.STRPTR; (* R: Name of node *)
toc * : Exec.STRPTR; (* W: Table of Contents *)
title * : Exec.STRPTR; (* W: Title to give to the node *)
next * : Exec.STRPTR; (* W: Next node to browse to *)
prev * : Exec.STRPTR; (* W: Previous node to browse to *)
END;
(* Methods 'openNode', 'closeNode' *)
OpNodeIO * = STRUCT (method * : Method)
attrs * : Utility.TagItemPtr; (* R: Additional attributes *)
node * : Exec.STRPTR; (* R: Node name and arguments *)
fileName * : Exec.STRPTR; (* W: File name buffer *)
docBuffer * : Exec.STRPTR; (* W: Node buffer *)
buffLen * : Exec.ULONG; (* W: Size of buffer *)
flags * : LONGSET; (* RW: Control flags *)
END;
CONST
(* NodeIO.flags *)
keep * = 0; (* Don't flush this node until database is closed. *)
reserved1 * = 1; (* Reserved for system use *)
reserved2 * = 2; (* Reserved for system use *)
ascii * = 3; (* Node is straight ASCII *)
reserved3 * = 4; (* Reserved for system use *)
clean * = 5; (* Remove the node from the database *)
done * = 6; (* Done with node *)
(* NodeIO.attrs (Tag IDs) *)
screen * = Utility.user + 1; (* Screen that window resides in *)
pens * = Utility.user + 2; (* Pen array (from DrawInfo) *)
rectangle * = Utility.user + 3; (* Window box *)
TYPE
(* Method 'expunge' *)
OpExpungeNode * = STRUCT (method * : Method)
attrs * : Utility.TagItemPtr; (* R: Additional attributes *)
END;
(*-------------------------------------------------------------------------*)
VAR
base * : Exec.LibraryPtr;
(* ----- Open/Close/Lock ----- *)
PROCEDURE OpenAmigaGuide * {base, -54}
( nag{8} : NewAmigaGuide;
control{9} : Exec.MsgPortPtr
) : AmigaGuideContext;
PROCEDURE OpenAmigaGuideAsyncA * {base, -60}
( nag{8} : NewAmigaGuide;
attrs{0} : ARRAY OF Utility.TagItem
) : AmigaGuideContext;
PROCEDURE OpenAmigaGuideAsync * {base, -60}
( nag{8} : NewAmigaGuide;
attrs{0}.. : Utility.Tag
) : AmigaGuideContext;
PROCEDURE CloseAmigaGuide * {base, -66} ( handle{8} : AmigaGuideContext );
PROCEDURE ExpungeDataBases * {base, -48} ( flush{0} : BOOLEAN );
PROCEDURE LockAmigaGuideBase * {base, -36} ( handle{8} : AmigaGuideContext )
: LONGINT;
PROCEDURE UnlockAmigaGuideBase * {base, -42} ( key{0} : LONGINT );
(* ----- Message handling ----- *)
PROCEDURE AmigaGuideSignal * {base, -72} ( handle{8} : AmigaGuideContext )
: LONGSET;
PROCEDURE GetAmigaGuideMsg * {base, -78} ( handle{8} : AmigaGuideContext )
: AmigaGuideMsgPtr;
PROCEDURE ReplyAmigaGuideMsg * {base, -84} ( msg{8} : AmigaGuideMsgPtr );
PROCEDURE SendAmigaGuideCmd * {base, -102}
( handle{8} : AmigaGuideContext;
cmd{0} : ARRAY OF CHAR;
future{1} : LONGINT
) : BOOLEAN;
(* ----- Contexts ----- *)
PROCEDURE SetAmigaGuideContext * {base, -90}
( handle{8} : AmigaGuideContext;
context{0} : Exec.ULONG;
future{1} : LONGINT
) : BOOLEAN;
PROCEDURE SendAmigaGuideContext * {base, -96}
( handle{8} : AmigaGuideContext;
future{0} : LONGINT
) : BOOLEAN;
(* ----- Attributes ----- *)
PROCEDURE SetAmigaGuideAttrs * {base, -108}
( handle{8} : AmigaGuideContext;
attrs{9}.. : Utility.Tag
) : LONGINT;
PROCEDURE SetAmigaGuideAttrsA * {base, -108}
( handle{8} : AmigaGuideContext;
attrs{9} : ARRAY OF Utility.TagItem
) : LONGINT;
PROCEDURE GetAmigaGuideAttr * {base, -114}
( tag{0} : Utility.Tag;
handle{8} : AmigaGuideContext;
VAR storage{9} : ARRAY OF Exec.BYTE
) : LONGINT;
(* ----- Crossreferences ----- *)
PROCEDURE LoadXRef * {base, -126}
( lock{8} : Dos.FileLockPtr;
name{9} : Exec.STRPTR
) : LONGINT;
PROCEDURE ExpungeXRef * {base, -132} ();
(* ----- Callback management ----- *)
PROCEDURE AddAmigaGuideHost * {base, -138}
( hook{8} : Utility.Hook;
name{0} : ARRAY OF CHAR;
attrs{9}.. : Utility.Tag
) : AmigaGuideHostPtr;
PROCEDURE AddAmigaGuideHostA * {base, -138}
( hook{8} : Utility.Hook;
name{0} : ARRAY OF CHAR;
attrs{9} : ARRAY OF Utility.TagItem
) : AmigaGuideHostPtr;
PROCEDURE RemoveAmigaGuideHost * {base, -144}
( key{8} : AmigaGuideHostPtr;
attrs{9}.. : Utility.Tag
) : LONGINT;
PROCEDURE RemoveAmigaGuideHostA * {base, -144}
( key{8} : AmigaGuideHostPtr;
attrs{9} : ARRAY OF Utility.TagItem
) : LONGINT;
(* ----- Environment searches ------- *)
PROCEDURE OpenE * {base, -150}
( path{8} : Dos.BSTR;
name{1} : ARRAY OF CHAR;
accessMode{2} : LONGINT
) : Dos.FileHandlePtr;
PROCEDURE LockE * {base, -156}
( path{8} : Dos.BSTR;
name{1} : ARRAY OF CHAR;
accessMode{2} : LONGINT
) : Dos.FileLockPtr;
(*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*)
(* OBSOLETE - DON'T USE! *)
PROCEDURE SetAmigaGuideHook * {base, -120} (* OBSOLETE *)
( handle{8} : AmigaGuideContext;
kind{0} : Exec.ULONG;
hook{9} : PROCEDURE;
data{10} : Exec.ADDRESS
) : BOOLEAN;
(*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*)
(* I found no docs about these functions - they seem to be private :-/
* Could someone please verify?
*)
(* PROCEDURE RLDispatch {base, -30} (p1,p2)(D0/D1) *)
PROCEDURE CopyPathList * {base, -162} ( path{8} : Dos.BSTR ) : Dos.BSTR;
PROCEDURE AddPathEntries * {base, -168}
( path{8} : Dos.BSTR;
names{0} : ARRAY OF Exec.STRPTR
) : Dos.BSTR;
PROCEDURE FreePathList * {base, -174} ( path{8} : Dos.BSTR );
PROCEDURE ParsePathString * {base, -180}
( string{0} : ARRAY OF CHAR;
names{8} : ARRAY OF Exec.STRPTR;
max{9} : Exec.ULONG
) : Exec.ULONG;
PROCEDURE OpenDataBase * {base, -186}
( lock{8} : Dos.FileLockPtr;
name{9} : ARRAY OF CHAR
) : Exec.APTR;
PROCEDURE LoadNode * {base, -192}
( client{8} : Exec.APTR;
database{9} : Exec.APTR;
node{10} : Exec.APTR
) : LONGINT;
PROCEDURE UnloadNode * {base, -198}
( client{8} : Exec.APTR;
database{9} : Exec.APTR;
node{10} : Exec.APTR
) : LONGINT;
PROCEDURE CloseDataBase * {base, -204} (database{8} : Exec.APTR) : LONGINT;
PROCEDURE GetAmigaGuideString * {base, -210} (id{0} : LONGINT) : Exec.STRPTR;
(*-------------------------------------------------------------------------*)
(* $StackChk- $RangeChk- $NilChk- $OvflChk- $ReturnChk- $CaseChk- *)
BEGIN
base := Exec.OpenLibrary (name, 33);
CLOSE
IF base # NIL THEN Exec.CloseLibrary (base); END;
END AmigaGuide.
(***************************************************************************)